package com.ztesoft.report.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ztesoft.report.base.pojo.R;
import com.ztesoft.report.base.service.impl.BaseServiceImpl;
import com.ztesoft.report.dao.ReportUploadDao;
import com.ztesoft.report.entity.ReportUpload;
import com.ztesoft.report.service.ReportUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 谭宏伟
 * @since 2018-06-13
 */
@Service
public class ReportUploadServiceImpl extends BaseServiceImpl<ReportUploadDao, ReportUpload> implements ReportUploadService {
    @Autowired
    ReportUploadDao reportUploadDao;

    @Override
    public R queryPage(Map<String, Object> map) {
        int current = (int) map.get("current");
        int size = (int) map.get("size");
        PageHelper.startPage(current, size);
        List<ReportUpload> list = null;
        try{
            list = reportUploadDao.queryPages(map);
        } catch (Exception e) {
            return R.error(e.getMessage());
        }
        PageInfo<Map<String, Object>> page = new PageInfo(list);
        return R.ok(page);
    }

}
